﻿using System.Collections.Generic;
using System.Linq;

namespace QueryResource.TextFormat
{


    internal class FormatMaster : ITextFormat
    {
        readonly List<ITextFormat> _formatList = new List<ITextFormat>();

        public void AddTextFormat(ITextFormat format)
        {
            _formatList.Add(format);
        }
        public void RemoveTextFormat(ITextFormat format)
        {
            if (_formatList.Contains(format))
            {
                _formatList.Remove(format);
            }
        }

        #region ITextFormat 成员

        public string TextFormat(string text)
        {
            return _formatList.Aggregate(text, (current, f) => f.TextFormat(current));
        }

        #endregion
    }

   


   

}
